package com.xbongbong.saas.model;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.pro.formdata.pojo.dto.SaasAnalysisDataDTO;
import com.xbongbong.saas.domain.entity.ext.CommunicatePlanEntityExt;
import org.elasticsearch.action.support.WriteRequest;

import java.util.List;
import java.util.Map;

/**
 * @author long.rao
 * @version v1.0
 * @date 2019/1/24 21:36
 * @since v1.0
 */
public interface CommunicatePlanModel extends IModel<CommunicatePlanEntityExt> {
    /**
     * 访客计划数据插入
     * @param entity 访客计划实体
     * @throws XbbException 异常
     * @return Integer
     * @author long.rao
     * @date 2019-02-01 15:28
     */
    @Override
    Integer insert(CommunicatePlanEntityExt entity) throws XbbException;
    /**
     * 访客计划数据更新
     * @param entity 访客计划实体
     * @throws XbbException 异常
     * @return Integer
     * @author long.rao
     * @date 2019-02-01 15:28
     */
    @Override
    Integer update(CommunicatePlanEntityExt entity) throws XbbException;
    /**
     * 访客计划数据查询多个
     * @param param 参数
     * @return List<CommunicatePlanEntityExt>
     * @author long.rao
     * @date 2019-02-01 15:28
     */
    @Override
    List<CommunicatePlanEntityExt> findEntitys(Map<String, Object> param);
    /**
     * 访客计划数据查询条数
     * @param param 参数
     * @return Integer
     * @author long.rao
     * @date 2019-02-01 15:28
     */
    @Override
    Integer getEntitysCount(Map<String, Object> param);
    /**
     * 访客计划数据单条查询
     * @param key 主键ID
     * @param corpid 公司ID
     * @return Integer
     * @author long.rao
     * @date 2019-02-01 15:28
     */
    CommunicatePlanEntityExt getByKey(Long key, String corpid);

    /**
     * 批量删除
     * @author 吴峰
     * @date 2019/4/10 10:39
     * @param idIn 数据列表
     * @param corpid 公司id
     * @return java.lang.Integer
     * @throws XbbException 业务异常
     */
    Integer deleteBatch(List<Long> idIn, String corpid) throws XbbException;

    /**
     * 单个删除
     * @param id
     * @param corpid
     * @return
     * @throws XbbException
     */
    Integer deleteByKey(Long id,String corpid) throws XbbException;

    /**
     * Description: 批量更新
     * @param updateDataList
     * @param corpid
     * @return java.lang.Integer
     * @author 魏荣杰
     * @date 2019/6/11 15:20
     * @since v1.0
     */
    Integer updateBatch(List<UpdateDataEntity> updateDataList, String corpid) throws XbbException;

    /**
     * 批量更新
     * @param updateList
     * @param corpid
     * @param refreshPolicy
     * @return
     */
    Integer updateBatch(List<UpdateDataEntity> updateList, String corpid, WriteRequest.RefreshPolicy refreshPolicy)  throws XbbException ;

    List findEntitysWithoutSub(Map<String, Object> param);

    /**
     * 访客计划编辑格式化数据格式
     * @param formDataUpdateGetDTO saas编辑数据
     * @param result 要返回的jsonobject
     * @throws XbbException 参数格式错误异常
     * @author long.rao
     * @date 2019-01-22 16:40
     */
    void formatData(SaasAnalysisDataDTO formDataUpdateGetDTO, JSONObject result) throws XbbException;
}
